Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Goodput & Badput recording and monitoring support. #783

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

dipannita08
Copy link

@dipannita08 dipannita08 commented Oct 25, 2024

This change adds the following:

  • Upgrades to the latest ml-goodput-measurement library
  • Integrates badput recording into the GoodputRecorder in AxLearn
  • Builds a Goodput monitor to configure and visualize Goodput and Badput using Tensorboard

Tested:

image

Copy link
Contributor

@markblee markblee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

axlearn/common/launch_trainer_main.py Outdated Show resolved Hide resolved
@Ethanlm
Copy link
Contributor

Ethanlm commented Oct 25, 2024

Functional end to end testing using fuji-test and fuji-7b (example tensorboard instance)

I don't have access to this link. Can you provide an example that we can take a look

axlearn/cloud/gcp/measurement.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/measurement.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/measurement_test.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/measurement.py Show resolved Hide resolved
axlearn/common/launch_trainer_main.py Show resolved Hide resolved
@markblee
Copy link
Contributor

markblee commented Nov 7, 2024

Please feel free to "re-request review" when ready. Thanks!

axlearn/cloud/gcp/measurement.py Outdated Show resolved Hide resolved
axlearn/cloud/gcp/measurement.py Outdated Show resolved Hide resolved
axlearn/common/trainer.py Outdated Show resolved Hide resolved
axlearn/common/trainer.py Outdated Show resolved Hide resolved
axlearn/common/trainer.py Outdated Show resolved Hide resolved
@dipannita08 dipannita08 requested a review from markblee November 25, 2024 21:36
Copy link
Contributor

@markblee markblee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack.

@dipannita08 dipannita08 requested a review from markblee December 2, 2024 17:22
axlearn/cloud/gcp/measurement.py Outdated Show resolved Hide resolved
axlearn/common/measurement.py Outdated Show resolved Hide resolved
@dipannita08 dipannita08 requested a review from a team as a code owner January 23, 2025 00:29
@dipannita08 dipannita08 requested a review from ruomingp January 23, 2025 00:33
Comment on lines 106 to 114
if not self._monitor:
# This could happen if there are internal errors (such as access errors) from GCP services such as Cloud Logging or Cloud Storage.
logging.log_first_n(
logging.WARNING,
"Goodput upload could not be started. Please check GoodputMonitor logs.",
1,
)
self._monitor.start_goodput_uploader(*args, **kwargs)
logging.info("Started Goodput upload to Tensorboard in the background!")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not self._monitor:
# This could happen if there are internal errors (such as access errors) from GCP services such as Cloud Logging or Cloud Storage.
logging.log_first_n(
logging.WARNING,
"Goodput upload could not be started. Please check GoodputMonitor logs.",
1,
)
self._monitor.start_goodput_uploader(*args, **kwargs)
logging.info("Started Goodput upload to Tensorboard in the background!")
if self._monitor:
self._monitor.start_goodput_uploader(*args, **kwargs)
logging.info("Started Goodput upload to Tensorboard in the background!")
else:
# This could happen if there are internal errors (such as access errors) from GCP services such as Cloud Logging or Cloud Storage.
logging.log_first_n(
logging.WARNING,
"Goodput upload could not be started. Please check GoodputMonitor logs.",
1,
)

So that we check that self._monitor is valid before invoking start_goodput_uploader.

BTW, it's still unclear to me how self._monitor can be None after we construct the instance of GoodputMonitor. Are we missing a try/catch somewhere? Does the __init__ method of GoodputMonitor raise an exception (that seems a bit unexpected)?

fv.mark_as_parsed()

recorder = GoodputRecorder.from_flags(fv)
recorder._recorder = mock.MagicMock()
recorder.record(measurement.Event.START_JOB)
self.assertTrue(recorder._recorder.record_job_start_time.called)

def test_start_monitoring(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this test the failure scenario?

@@ -47,6 +59,10 @@ def record(self, event: Event, *args, **kwargs):
"""Records an event with the given name."""
raise NotImplementedError(type(self))

def start_monitoring(self, **kwargs):
"""Starts computing and uploading metrics at some configured interval in the background."""
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's raise NotImplementedError(type(self)) and let subclasses decide whether to implement -- it should be fairly straightforward for a subclass to decide to not monitor, but we want the decision to be explicit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, it was originally raising NotImplementedError(type(self)), but I suggested to change to pass to avoid breaking subclasses upon axlearn bump.

Do we have tests to catch such breakage?

include_badput_breakdown=True,
)
if not self._monitor:
# This could happen if there are internal errors (such as access errors) from GCP services such as Cloud Logging or Cloud Storage.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I just triggered the CI, sorry for not doing so early. (I suspect lines like this will fail pylint for being too long.)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will re-run precomit checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants